package com.lmaos.basetools.proxy.autoproxy;

import java.lang.reflect.Modifier;

import javassist.CtMethod;

import com.lmaos.basetools.proxy.EnableProxyIntercept;

public class DefaultEnableProxyIntercept implements EnableProxyIntercept<CtMethod>{
	private boolean staticOk = false;
	private boolean finalOk = false;
	@Override
	public boolean enableClassname(String classname) {

		return true;
	}

	@Override
	public boolean enableMethod(CtMethod method) {
		int modifiersId = method.getModifiers();
		if(!staticOk&&Modifier.isStatic(modifiersId)){
			return false;
		}
		if(!finalOk&&Modifier.isFinal(modifiersId)){
			return false;
		}
		return true;
	}
	
	public void setFinalOk(boolean finalOk) {
		this.finalOk = finalOk;
	}
	public void setStaticOk(boolean staticOk) {
		this.staticOk = staticOk;
	}

	public boolean isStaticOk() {
		return staticOk;
	}

	public boolean isFinalOk() {
		return finalOk;
	}

}
